<!--

/*
* Copyright (C) 2005-2013 University of Sydney
*
* Licensed under the GNU License, Version 3.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.gnu.org/licenses/gpl-3.0.txt
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/

/**
* Original map viewer for GMap2
*
* @author      Kim Jackson
* @author      Stephen White   <stephen.white@sydney.edu.au>
* @author      Artem Osmakov   <artem.osmakov@sydney.edu.au>
* @copyright   (C) 2005-2013 University of Sydney
* @link        http://Sydney.edu.au/Heurist
* @version     3.1.0
* @deprecated
* @license     http://www.gnu.org/licenses/gpl-3.0.txt GNU License 3.0
* @package     Heurist academic knowledge management system
* @subpackage  Viewers/Map
*/

-->

<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <link rel=stylesheet href="../../common/css/heurist.css">
  <title>Heurist Resource Database - Map and Timeline</title>

  <style>

  </style>
  <!--<script src="http://simile.mit.edu/timeline/api/timeline-api.js"></script> -->
  <script src="../../external/simile/timeline-api.js" type="text/javascript"></script>
  <link rel="stylesheet" href="../../common/css/maps.css"/>

 </head>

 <body onload="load();" style="margin: 0; padding: 0;">

  <table border=0 cellspacing=0 cellpadding=0 id=all-table><tbody>
   <tr><td id=map-cell><div id=map></div></td></tr>
   <tr><td id=resizer><div>&nbsp;</div></td></tr>
   <tr><td id=timeline-cell><div id=timeline></div></td></tr>
   <tr><td id=info-cell>
    <div id=info>
     <label for=filter><input type=checkbox id=filter onclick="timeChange()"> Filter to timebar span</label>
     #Records: <span id=record-count></span> / <span id=total-record-count></span>
    </div>
   </td></tr>
  </tbody></table>

  <script>
  var HEURIST = {};
document.write('<scr'+'ipt src="'+location.pathname.replace(/\/[^\/]*$/,"/")+'getTMapDataFromQuery.php' + location.search + '"></scr'+'ipt>');
</script>


  <script>
if (location.search.match(/\btimeline=0\b/)) {
	var tdTimeline = document.getElementById("timeline-cell");
	tdTimeline.style.display = "none";
	tdTimeline.parentNode.style.display = "none";
	var tdResizer = document.getElementById("resizer");
	tdResizer.style.display = "none";
	tdResizer.parentNode.style.display = "none";
	document.getElementById("info-cell").style.display = "none";
}
</script>


  <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAGZugEZOePOFa_Kc5QZ0UQRQUeYPJPN0iHdI_mpOIQDTyJGt-ARSOyMjfz0UjulQTRjpuNpjk72vQ3w"></script>
  <script src="epoly.js"></script>
  <script src="elabel.js"></script>

  <script src="../js/ClusterMarker.js"></script>
  <script src="loadGMap.js"></script>
  <script src="loadTimeline.js"></script>

  <script>
if (top.HEURIST) {
	top.HEURIST.registerEvent(this,"heurist-selectionchange",onSelectionChange);
}

function load(){
	if (HEURIST.tmap.totalRecordCount == 0) {
		document.body.style.margin = "10px";
		document.body.innerHTML = "<h3>The search results you are trying to plot do not contain any geographic objects</h3>";
		if (window.stop) window.stop();
		else if (document.execCommand) document.execCommand("Stop");
	}
	else {
		document.getElementById("record-count").innerHTML = "" + HEURIST.tmap.totalRecordCount;
		document.getElementById("total-record-count").innerHTML = "" + HEURIST.tmap.totalRecordCount;
	}
	if (HEURIST.tmap.totalRecordCount > 0) {
		loadMap({ compact: location.search.match(/\bcompact=1\b/) });
		if (! location.search.match(/\btimeline=0\b/)) loadTimeline();
	}

	var resizerCell = document.getElementById("resizer");
	var timelineCell = document.getElementById("timeline-cell");
	if (resizerCell) {
		resizerCell.onmousedown = function(e) {
			if (! e) e = window.event;

			var downY = e.pageY || e.clientY;
			var downHeight = timelineCell.offsetHeight;

			resizerCell.document_mouseup = function(e) {
				if (! e) e = window.event;

				var upY = e.pageY || e.clientY;
				var upHeight = downHeight + (downY - upY);

				timelineCell.style.height = upHeight + "px";
				timeline.layout();

				if (top.HEURIST.deregisterEvent) {
					top.HEURIST.deregisterEvent(document, "mouseup", resizerCell.document_mouseup);
				}else if (window.removeEventListener) {
					document.removeEventListener("mouseup", resizerCell.document_mouseup,true);
				} else if (window.detachEvent) {
					document.detachEvent("onmouseup", resizerCell.document_mouseup);
				}
			};

			if (top.HEURIST.registerEvent){
				top.HEURIST.registerEvent(document, "mouseup", resizerCell.document_mouseup);
			}else if (window.addEventListener) {
				document.addEventListener("mouseup", resizerCell.document_mouseup,true);
			} else if (window.attachEvent) {
				document.attachEvent("onmouseup", resizerCell.document_mouseup);
			}
		};
	}
}

function onSelectionChange(eventType, argList) {
	if (parent.document.getElementById("m").className == "yui-hidden") {
		return false;
		}else {
	if (eventType == "heurist-selectionchange"){
	top.HEURIST.search.mapSelected();}
	}
}
  </script>

 </body>
</html>
